package com.ghp.common.utils;

/**
 * @author ghp
 * @title ThreadLocal工具类
 * @description
 */
public class ThreadLocalUtils {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置当前用户的id
     * @param id
     */
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }

    /**
     * 获取当前用户id
     * @return
     */
    public static Long getCurrentId(){
        return threadLocal.get();
    }

    /**
     * 移除当前用户id
     */
    public static void removeCurrentId(){
        threadLocal.remove();
    }
}
